#xxxxxxxxxxxxxxxxxxxxxxxcxxx 打包系统库
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)   # Win10 以前必备; 安装 Windows 通用 CRT（UCRT）库
set(CMAKE_INSTALL_DEBUG_LIBRARIES FALSE) # Debug 版 runtime
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)  # 禁止自动 install, 可以手动定制
include(InstallRequiredSystemLibraries)
message(STATUS "[my] System runtime detected:")
if(FALSE)
foreach(f ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
    message("    ${f}")
endforeach()
endif()

#xxxxxxxxxxxxxxxxxxxxxxxxxxx 3rd 库的 .dll/.so
#安装主程序
# install(TARGETS ${MYEXE} DESTINATION bin)
install(TARGETS ${MY_EXE}
    RUNTIME DESTINATION bin
)

install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/runtime/"
    DESTINATION bin
    USE_SOURCE_PERMISSIONS
    ## 单独组件名, 可以使用 cmake --install . --component conan_runtime 单独装
    # COMPONENT conan_runtime
)
#xxxxxxxxxxxxxxxxxxxxxxxxxxx 3rd lib header-only 库
install(DIRECTORY "${MY_THIRD_PARTY_HXX}/"
    DESTINATION include
    USE_SOURCE_PERMISSIONS
)


##xxxxxxxxxxxxxxxxxxxxxxxxxxx cpack 设置
set(CPACK_GENERATOR "ZIP")       # Windows 用 ZIP/NSIS, macOS 用 DragNDrop
set(CPACK_PACKAGE_NAME ${MY_EXE})
set(CPACK_PACKAGE_VERSION ${MY_EXE_VERSION})
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/dist_package")
include(CPack)